var t = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../utils/util.js")), a = getApp();

Page({
    data: {
        istrue: [ {
            id: 0,
            tit: "全部"
        }, {
            id: 1,
            tit: "待付款"
        }, {
            id: 2,
            tit: "报名成功"
        } ],
        curr: 0,
        page: 1,
        id: wx.getStorageSync("yz_uid")
    },
    onLoad: function(t) {
        this.getdata(this.data.curr);
    },
    goBmxq: function(t) {
        console.log(t.currentTarget.id), wx.navigateTo({
            url: "/packageC/Myshaky/RegistrationDetail/RegistrationDetail?id=" + t.currentTarget.id
        });
    },
    toRefund: function(t) {
        var a = t.currentTarget.id, e = t.currentTarget.dataset.item;
        console.log(e), e.refund_id ? wx.navigateTo({
            url: "/packageD/member/myOrder/Aftersales/Aftersales?refund_id=" + e.refund_id
        }) : wx.navigateTo({
            url: "/packageD/member/myOrder/refund/refund?order_id=" + a + "&type=1"
        });
    },
    getLine: function(t) {
        console.log(t.target.id), console.log(this.data.page), this.setData({
            curr: t.target.id,
            page: 1
        }), this.getdata(this.data.curr);
    },
    toPay: function(t) {
        console.log(t.currentTarget.id);
        var a = t.currentTarget.id;
        wx.navigateTo({
            url: "/packageD/buy/orderPay/orderPay?order_id=" + a + "&name=Myshaky"
        });
    },
    cancleOrder: function(t) {
        console.log(t.currentTarget.id);
        var e = t.currentTarget.id;
        wx.showModal({
            title: "提示",
            content: "确定取消此订单?",
            success: function(t) {
                if (t.confirm) {
                    console.log("用户点击确定");
                    var r = a.getNetAddresss("order.operation.close");
                    a._getNetWork({
                        url: r,
                        data: {
                            order_id: e
                        },
                        success: function(t) {
                            var a = t.data;
                            console.log(a);
                        },
                        fail: function(t) {
                            console.log(t);
                        }
                    });
                } else t.cancel && console.log("用户点击取消");
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page < this.data.last_page ? (wx.showLoading({
            title: "加载中",
            mask: !0
        }), this.setData({
            page: this.data.page + 1
        }), console.log(this.data.page), this.getNext()) : wx.showToast({
            title: "没有更多",
            icon: "none"
        });
    },
    onShareAppMessage: function() {},
    getdata: function(e) {
        var r = a.getNetAddresss("plugin.activity-apply.api.lecturer.getOrder"), o = this;
        a._getNetWork({
            url: r,
            data: {
                member_id: o.data.id,
                page: o.data.page,
                status: e
            },
            success: function(a) {
                var e = a.data;
                if (console.log(e), 1 == e.result) {
                    for (var r = e.data.data, i = 0; i < r.length; i++) r[i].start_time = t.default.formatTimeTwo(r[i].start_time, "Y/M/D h:m:s");
                    o.setData({
                        datas: r,
                        current_page: e.data.current_page,
                        last_page: e.data.last_page
                    });
                }
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getNext: function() {
        var e = a.getNetAddresss("plugin.activity-apply.api.lecturer.getOrder"), r = this;
        a._getNetWork({
            url: e,
            data: {
                member_id: r.data.id,
                page: r.data.page,
                status: r.data.curr
            },
            success: function(a) {
                var e = a.data;
                if (console.log(e), 1 == e.result) {
                    for (var o = e.data.data, i = 0; i < o.length; i++) o[i].start_time = t.default.formatTimeTwo(o[i].start_time, "Y/M/D h:m:s");
                    if (e.data.current_page > e.data.last_page) return wx.hideLoading(), wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void r.setData({
                        current_page: e.data.current_page,
                        last_page: e.data.last_page
                    });
                    wx.hideLoading(), r.setData({
                        datas: r.data.datas.concat(o)
                    });
                }
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});